<%--
  Created by IntelliJ IDEA.
  User: Peter
  Date: 2024/1/16
  Time: 22:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
    <head>
        <title>Brand</title>
    </head>
    <body>
        <h1>品牌列表</h1>
        <br>
        当前用户：${uname} <a href="/JSP814/logout">注销</a>
        <br>

        page:${page}<br>



        <a href="addBrand.jsp">新增</a>
        <hr>
        <%--        brands: ${brands}--%>
        <table bgcolor="#deb887" border="1">

            <tr>
                <th>序号</th>
                <th>品牌名称</th>
                <th>企业名称</th>
                <th>排序</th>
                <th>品牌介绍</th>
                <th>类别</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${brands}" var="brand" varStatus="status">

                <tr align="center">
                    <td>${status.count}</td>
                    <td>${brand.brandName}</td>
                    <td>${brand.companyName}</td>
                    <td>${brand.ordered}</td>
                    <td>${brand.description}</td>
                    <td>${brand.brandType.typeName}</td>
                    <c:if test="${brand.status==1}">
                        <td>启用</td>
                    </c:if>
                    <c:if test="${brand.status!=1}">
                        <td>禁用</td>
                    </c:if>

                    <td>
                        <a href="/JSP814/edit?brandName=${brand.brandName}&companyName=${brand.companyName}&id=${brand.id}&ordered=${brand.ordered}&description=${brand.description}&status=${brand.status}&brandType=${brand.brandType.typeName}">
                            修改 </a><a
                            href="/JSP814/delete?id=${brand.id}"> 删除
                    </a></td>
                </tr>
            </c:forEach>


        </table>
        <br>
        <div class="paging">
            <c:if test="${page>-1 and page!=1}">
                <a class="button" href="brands?page=${page-1}">上一页&nbsp;&nbsp;</a>
            </c:if>

            <c:if test="${page==1}">

            </c:if>


            <c:forEach var="i" begin="1" end="5">
                <a href="brands?page=${i}">${i}&nbsp;&nbsp;</a>

            </c:forEach>


            <c:if test="${page>=5}">
                <%--                <a class="button" href="#">下一页&nbsp;&nbsp;</a>--%>
            </c:if>
            <c:if test="${page<5}">
                <a class="button" href="brands?page=${page+1}">&nbsp;&nbsp;下一页</a>
            </c:if>


        </div>


    </body>
</html>
